Page({
  data: {
    num: 0,
    text: ""
  },
  reset() {
    wx.setStorageSync('token', "")
    wx.setStorageSync('uuid', "")
    wx.setStorageSync('cmp_uuid', "")
  },
  click() {
    this.data.num++;
    if (this.data.num > 5) {
      let requestUrl = wx.getStorageSync('$requestUrl')
      if (requestUrl.indexOf("beta") > -1) {
        wx.setStorageSync('$requestUrl', "https://alpha.kaibanshenqi.net")
        wx.setEnableDebug({
          enableDebug: false
        })
        this.reset()
        this.setData({
          text: "当前为alpha环境，需开启调试模式"
        })
      } else {
        wx.setStorageSync('$requestUrl', "https://beta.kaibanshenqi.net")
        wx.setEnableDebug({
          enableDebug: true
        })
        this.reset()
        this.setData({
          text: "当前为beta环境"
        })
      }
      this.data.num = 0
    }
  },
  onLoad(e) {
    let requestUrl = wx.getStorageSync('$requestUrl')
    if (requestUrl.indexOf("beta") > -1) {
      this.setData({
        text: "当前为beta环境"
      })
    }
    if (requestUrl.indexOf("alpha") > -1) {
      this.setData({
        text: "当前为alpha环境，需开启调试模式"
      })
    }
  }
})